package com.kinghood.infrastructure.api.authority;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 模块（1：组织架构，2：角色权限，3：数字字典，21：商品管理，22：类目管理，23：经营配置基础配置）
 *
 * @author zhangFanJun
 * @date 2024-01-03 14:31
 **/
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum SysLogModuleEnum {

    /**
     * 组织架构
     */
    AUTHORITY_ORGANIZATIONAL_STRUCTURE(1, "组织架构"),
    /**
     * 角色权限
     */
    AUTHORITY_ROLE(2, "角色权限"),
    /**
     * 数字字典
     */
    AUTHORITY_DIRECTION(3, "数字字典"),
    /**
     * 菜单
     */
    AUTHORITY_MENU(4, "数字字典"),
    /**
     * api
     */
    AUTHORITY_API(5, "数字字典"),
    /**
     * 款式管理
     */
    PRODUCT_PRODUCT(21, "款式管理"),
    PRODUCT_SKU(22, "SKU管理"),
    PRODUCT_CATEGORY(23, "品类管理"),
    PRODUCT_GOODS(24, "货类管理"),
    PRODUCT_ATTRIBUTE(25, "属性管理"),
    PRODUCT_LABEL(26, "标签管理"),
    PRODUCT_TEMPLATE(27, "款式模版管理"),
    PRODUCT_CODE_RULE(28, "编码规则管理"),
    PRODUCT_BRAND(29, "品牌管理"),
    PRODUCT_SUPPLIER(30, "供应商管理"),
    PRODUCT_DOWNLOAD(31, "下载中心管理"),
    ;

    private Integer type;
    private String name;

    public static String getNameByType(Integer type) {
        for (SysLogModuleEnum e : values()) {
            if (Objects.equals(type, e.getType())) {
                return e.getName();
            }
        }
        return null;
    }

    public interface Type{

        int SECRET = 0;
        int AUTHORITY_ORGANIZATIONAL_STRUCTURE = 1;
        int AUTHORITY_ROLE = 2;
        int AUTHORITY_DIRECTION = 3;
        int AUTHORITY_MENU = 4;
        int AUTHORITY_API = 5;

        int PRODUCT_PRODUCT = 21;
        int PRODUCT_SKU = 22;
        int PRODUCT_CATEGORY = 23;
        int PRODUCT_GOODS = 24;
        int PRODUCT_ATTRIBUTE = 25;
        int PRODUCT_LABEL = 26;
        int PRODUCT_TEMPLATE = 27;
        int PRODUCT_CODE_RULE = 28;
        int PRODUCT_BRAND = 29;
        int PRODUCT_SUPPLIER = 30;
        int PRODUCT_DOWNLOAD = 31;
    }
}
